CREATE PROCEDURE [dbo].[ReferrerGet]
	@Id				UNIQUEIDENTIFIER,
	@FirstName		NVARCHAR(50),
	@LastName		NVARCHAR(50)
AS

SELECT	R.*
FROM	Referrer R
WHERE	(@Id IS NULL OR R.Id = @Id)
	AND (@FirstName IS NULL OR R.FirstName = @FirstName)
	AND (@LastName IS NULL OR R.LastName = @LastName)
ORDER By R.LastName, R.FirstName
	
RETURN @@ROWCOUNT